import java.util.StringTokenizer;


class P460_39643 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

	
	public static void main(String[] args) {
		
		int cases = Integer.parseInt(readLn());

		for (int k = 0; k < cases; k++) {
			readLn();
			
			StringTokenizer st = new StringTokenizer(readLn());
			
			int xll1 = Integer.parseInt(st.nextToken());
			int yll1 = Integer.parseInt(st.nextToken());
			int xur1 = Integer.parseInt(st.nextToken());
			int yur1 = Integer.parseInt(st.nextToken());
			
			st = new StringTokenizer(readLn());
			
			int xll2 = Integer.parseInt(st.nextToken());
			int yll2 = Integer.parseInt(st.nextToken());
			int xur2 = Integer.parseInt(st.nextToken());
			int yur2 = Integer.parseInt(st.nextToken());
			
			Rectangle460 r1 = new Rectangle460(xll1, yll1, xur1, yur1);
			Rectangle460 r2 = new Rectangle460(xll2, yll2, xur2, yur2);
			
			if (r1.intersects(r2)) {
				r1.intersection(r2);
			} else {
				System.out.println("No Overlap");
			}
			
			
			if (k + 1 != cases) System.out.println();
		}
		
	}
	
}


class Rectangle460 {
	
	int x, y, height, width;
	
	public Rectangle460(int xll, int yll, int xur, int yur) {
		
		this.x = xll;
		this.y = yll;
		this.width = xur - x;
		this.height = yur - y;
		
	}
	
	public boolean intersects(Rectangle460 r) {
		int tw = this.width;
		int th = this.height;
		int rw = r.width;
		int rh = r.height;
		if (rw <= 0 || rh <= 0 || tw <= 0 || th <= 0) {
		    return false;
		}
		int tx = this.x;
		int ty = this.y;
		int rx = r.x;
		int ry = r.y;
		rw += rx;
		rh += ry;
		tw += tx;
		th += ty;
		//      overflow || intersect
		return ((rw < rx || rw > tx) &&
			(rh < ry || rh > ty) &&
			(tw < tx || tw > rx) &&
			(th < ty || th > ry));
	    }

    public void intersection(Rectangle460 r) {
    	int tx1 = this.x;
    	int ty1 = this.y;
    	int rx1 = r.x;
    	int ry1 = r.y;
    	long tx2 = tx1; tx2 += this.width;
    	long ty2 = ty1; ty2 += this.height;
    	long rx2 = rx1; rx2 += r.width;
    	long ry2 = ry1; ry2 += r.height;
    	if (tx1 < rx1) tx1 = rx1;
    	if (ty1 < ry1) ty1 = ry1;
    	if (tx2 > rx2) tx2 = rx2;
    	if (ty2 > ry2) ty2 = ry2;
    	tx2 -= tx1;
    	ty2 -= ty1;
    	// tx2,ty2 will never overflow (they will never be
    	// larger than the smallest of the two source w,h)
    	// they might underflow, though...
    	if (tx2 < Integer.MIN_VALUE) tx2 = Integer.MIN_VALUE;
    	if (ty2 < Integer.MIN_VALUE) ty2 = Integer.MIN_VALUE;

    	
    	System.out.println(tx1 + " " + ty1 + " " + (tx1 + tx2) + " " + (ty1 + ty2));
    	
//    	return new Rectangle(tx1, ty1, (int) tx2, (int) ty2);
        }

	
}